package top.kaoshanji.p1ch02b.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.kaoshanji.p1ch02b.main.Parrot;

/**
 * 为项目定义配置类
 * @author kaoshanji
 * ^_^
 * create time 2025/4/27 15:27
 */
@Configuration
public class ProjectConfig {

    /**
     * 代码清单-p1ch02b-30页a：定义@Bean方法
     * @return Parrot
     */
    @Bean
    public Parrot parrot() {
        var p = new Parrot();
        p.setName("Koko");

        return p;
    }

    // 向上下文添加两个bean
    @Bean
    public String hello() {
        return "Hello";
    }

    @Bean
    public Integer ten() {
        return 10;
    }


}
